package com.itheima.consumer.listener;

import org.springframework.amqp.rabbit.annotation.RabbitListener;

import java.time.LocalDateTime;

/**
 * @version 1.0
 * @Author lwx
 * @Date 2024/12/27 14:46
 */
//@Component
public class WorkQueueListener {

    @RabbitListener(queues = "work.queue")
    public void listener1(String msg) throws InterruptedException {
        Thread.sleep(20);
        System.out.println("消费者1号接收到消息。。。。。：" + msg+"||1||"+ LocalDateTime.now());
    }

    @RabbitListener(queues = "work.queue")
    public void listener2(String msg) throws InterruptedException {
        Thread.sleep(200);
        System.out.println("消费者2号接收到消息：" + msg+"||2||"+LocalDateTime.now());
    }

}
